package com.hudongwx.yuan_sdjj.fragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.hudongwx.yuan_sdjj.R;
import com.hudongwx.yuan_sdjj.view.InputView;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

/**
 * A simple {@link Fragment} subclass.
 */
@ContentView(R.layout.fragment_reg)
public class RegFragment extends Fragment {
    @ViewInject(R.id.reg_user_input)
    private InputView userInput;
    @ViewInject(R.id.reg_pwd_input)
    private InputView pwdInput;
    @ViewInject(R.id.reg_view_see)
    private ImageView seePwdIv;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = x.view().inject(this, inflater, container);
        pwdInput.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD);
        return view;
    }
    @Event(R.id.reg_view_see)
    private void lookPwd(View view){
        if(pwdInput.getInputType()== InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD){//明文 如果能看到
            //再次点击  设置成密码看不见  图片闭上眼睛
            pwdInput.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD);
            seePwdIv.setSelected(false);
        }else {
            // 设置成密码看得见  初始的时候进来，设置为可见，图片页睁开眼
            pwdInput.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            seePwdIv.setSelected(true);
        }
    }

}
